export const report_shortcuts = {
  shortcuts: [
    {
      text: "昨天",
      onClick(picker) {
        const end = new Date();
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 1);
        picker.$emit("pick", [start, start]);
      }
    },
    {
      text: "今天",
      onClick(picker) {
        const end = new Date();
        const start = new Date();
        picker.$emit("pick", [start, end]);
      }
    },
    {
      text: "当月",
      onClick(picker) {
        var date = new Date(),
          y = date.getFullYear(),
          m = date.getMonth();
        var firstDay = new Date(y, m, 1);
        var lastDay = new Date(y, m + 1, 0);
        picker.$emit("pick", [firstDay, lastDay]);
      }
    },
    {
      text: "上月",
      onClick(picker) {
        var nowDate = new Date();
        var year = nowDate.getFullYear();
        var month = nowDate.getMonth();
        if (month == 0) {
          month = 12;
          year = year - 1;
        }
        var lastDay = new Date(year, month, 0);
        var time1 = year + "-" + month + "-" + lastDay.getDate();
        var time2 = year + "-" + month + "-" + "01";
        const start = new Date(time1);
        const end = new Date(time2);
        start.setTime(new Date(start));
        end.setTime(new Date(end));
        picker.$emit("pick", [end, start]);
      }
    }
  ]
};
